package com.mes.service.impl;

import com.mes.entity.Technology;
import com.mes.mapper.TechnologyMapper;
import com.mes.service.TechnologyService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author DELL
 * @description 针对表【technology】的数据库操作Service实现
 * @createDate 2024-09-18 09:37:00
 */
@Service
public class TechnologyServiceImpl implements TechnologyService {


    @Autowired
    private TechnologyMapper technologyMapper;

    @Override
    public Map listByPage(Integer pageNum, Integer pageSize, Technology technology) {

        Map map = new HashMap();
        int offset = (pageNum-1)*pageSize;
        RowBounds rowBounds = new RowBounds(offset, pageSize);
        List<Technology> list = technologyMapper.listByPage(technology, rowBounds);
        List<Technology> totalList = technologyMapper.listByPage(technology);
        int total = totalList.size();
        map.put("list", list);
        map.put("total", total);
        return map;
    }

    @Override
    public int save(Technology technology) {
        return technologyMapper.save(technology);
    }

    @Override
    public int deleteById(Integer id) {
        return technologyMapper.deleteById(id);
    }

    @Override
    public int update(Technology technology) {
        return technologyMapper.update(technology);
    }
}




